package ca.jsbr.canvaswar.screen 
{
	import ca.jsbr.as2js_lib.display.canvas.view.Image;
	import ca.jsbr.as2js_lib.display.canvas.view.input.ButtonView;
	import ca.jsbr.as2js_lib.display.canvas.view.ShapeView;
	import ca.jsbr.as2js_lib.display.canvas.view.TextView;
	import ca.jsbr.as2js_lib.event.MouseJSEvent;
	import ca.jsbr.as2js_lib.utils.assets.AssetsFactory;
	import ca.jsbr.canvaswar.screen.Screen;
	import ca.jsbr.canvaswar.screen.Screens;
	import ca.jsbr.canvaswar.ScreenManager;
	import ca.jsbr.tinyUI.container.Box;
	import ca.jsbr.tinyUI.input.Button;
	import flash.events.Event;
	/**
	 * ...
	 * @author jsbr [me@jsbr.ca]
	 */
	public class HomeScreen extends Screen
	{
		public static const NAME:String = "HomeView";
		private var _bg:Image;
		private var _btn:ButtonView;
		private var _txt:TextView;
		private var _txt2:TextView;
		
		
		public function HomeScreen() 
		{
			_bg = new Image(AssetsFactory.getInstance().getAssets("title_screen"));
			addChild(_bg);
			_name = "HomeScreen";
		}
		
		
		override public function init():Object 
		{
			super.init();
			
			/*var box:Box = new Box();
			box.height = 200;
			box.x = 200;
			addChild(box);
			
			var btn:Button = new Button("helloWorld");
			
			btn.x = 400;
			addChild(btn);*/
			
			_txt = new TextView();
			_txt.text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin varius, est et tempus consectetur, metus lacus convallis nisl, sit amet feugiat sem purus a felis. Etiam ac libero quis sapien aliquam bibendum. Proin ornare leo sit amet sapien egestas ultricies. Nunc nec ligula quis lacus sodales interdum non vel urna. Nullam nec eros eu tellus tincidunt feugiat ac pulvinar nibh. Maecenas ut neque elit. Vivamus pretium pretium nisi, sit amet placerat quam euismod at. Aliquam nisl risus, lobortis vitae pharetra eget, molestie vitae nibh. Vestibulum ultrices eleifend sem, ac sollicitudin velit bibendum at. Cras pulvinar dignissim risus ornare porta.";
			_txt.width = 300;
			_txt.multiline = true;
			_txt.x = 10;
			_txt.y = 100;
			addChild(_txt);
		
			_btn = new ButtonView(AssetsFactory.getInstance().getAssets("play_btn"), 4);
			_btn.name = "play";
			_btn.addEventListener(MouseJSEvent.MOUSE_CLICK, onClickPlay);
			_btn.x = stage.width / 2 - _btn.width / 2;
			_btn.y = stage.height / 2 - _btn.height / 2;
			addChild(_btn);
		}
		

		private function onClickPlay(e:Event):void 
		{
			ScreenManager.getInstance().openScreen(Screens.GAME_SCREEN);
		}
	}

}